//
//  BaseTableViewController.swift
//  新浪微播
//
//  Created by lxw on 15/12/15.
//  Copyright © 2015年 lxw. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorLoginViewDelegate{
    var userLogin =  false//UserAccountViewModel().userLogin
    var visitorLoginView: VisitorLoginView?
    override func loadView() {
        if userLogin {
            super.loadView()
        }else{
            //setVisitorLoginView()
            setVisitorLoginView()
        }
    }
    private func setVisitorLoginView(){
        visitorLoginView = VisitorLoginView()
        visitorLoginView?.visitroViewDelegate = self
        view = visitorLoginView
        
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "登陆", style: .Plain, target: self, action: "userWillLogin")
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: "userWillRegister")
    }
  
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    func userWillLogin() {
        print(__FUNCTION__)
        let oauth = OAuthViewController()
        let nav = UINavigationController(rootViewController: oauth)
        presentViewController(nav, animated: true, completion: nil)
    }
    
    func userWillRegister() {
        print(__FUNCTION__)
    }


}
